package aecs

import (
	"fmt"
	"os"

	"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
)

func LookUpImage() {

	client, err := ecs.NewClientWithAccessKey("Southwest08", "7bcbc1983a894daaa917ce5576840ac2", "64a00ec11ae64723a141881880ef23d9")
	client.Domain = "175.155.64.67" //pay attention the port number just for easy use.
	client.SetLogger("debug", "AlibabaCloud", os.Stdout, "")
	client.GetConfig().Debug = false

	if err != nil {
		panic(err)
	}
	request := ecs.CreateDescribeImagesRequest()
	fmt.Println("port is:", request.GetPort())
	request.Method = "GET"
	request.Port = "8788"
	fmt.Println("build url is:", request.BuildUrl())
	fmt.Println(request.GetBodyReader())
	dir, err2 := client.DescribeImages(request)

	if err2 != nil {
		fmt.Println(err2)
	}
	// fmt.Println(dir.Images.Image[0].ImageId)
	fmt.Println(dir.GetHttpContentString())
}
